import cv2

# 创建窗口
cv2.namedWindow('win',cv2.WINDOW_NORMAL)
# 创建窗口大小
cv2.resizeWindow('win',100,100)
# 显示窗口
cv2.imshow('win',0)
# 等待键盘输入
key = cv2.waitKey(0)
if key & 0xFF == ord('q'):
    exit()
# 关闭窗口
cv2.destroyAllWindows()